﻿using System;
using System.Runtime.Serialization;

namespace Kobets.Automation.Chimera.Common
{
    /// <summary>
    /// Provides serialization for Agent
    /// </summary>
    [Serializable]
    public class SerializableAgent : Agent, ISerializable
    {
        public SerializableAgent()
        {
            
        }

        public SerializableAgent(SerializationInfo info, StreamingContext ctxt)
        {
            Name = (string)info.GetValue("Name", typeof(string));
            NetworkName = (string)info.GetValue("NetworkName", typeof(string));
            Status = (Enums.AgentStatus)info.GetValue("Status", typeof(Enums.AgentStatus));
            Controller = (string)info.GetValue("Controller", typeof(string));
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Name", Name);
            info.AddValue("NetworkName", NetworkName);
            info.AddValue("Status", Status);
            info.AddValue("Controller", Controller);
        }
    }
}
